Skip to main content

Format Conversion Scripts

Utilities for converting planetary geospatial data between various formats including ISIS3, 3D mesh formats, and specialized projections.

Astropedia_gdal2ISIS3.py

Creates ISIS3-compatible cube files with detached labels from GDAL-supported images.

Usage

Parameters

string
required
Input GDAL-supported georeferenced image
string
required
Output ISIS3 cube filename

Options

flag
Print detailed image information during processing
flag
Generate only the label file (.lbl) without creating the image cube
flag
Attach the label to the ISIS image using ISIS3 cubeatt (requires ISIS3 installation)
flag
Force longitude domain to 0-360 instead of -180 to 180
float
Override the center longitude value
float
Set the pixel base value for DN conversion
float
Set the pixel multiplier/scale value

Output Files

The script creates multiple output files:
  • output.cub - Raw image data in ENVI format
  • output.lbl - ISIS3 detached label with metadata
  • output.History.IsisCube - Processing history

Supported Projections

  • Simple Cylindrical (GEOGCS)
  • Equirectangular
  • Sinusoidal
  • Transverse Mercator
  • Orthographic
  • Mercator
  • Polar Stereographic (North/South)

Example

Data Types Supported

  • Byte - 8-bit unsigned integer
  • Int16 - 16-bit signed integer
  • UInt16 - 16-bit unsigned integer
  • Float32 - 32-bit floating point
  • Float64 - Converted to Float32
Float32/Real types do not use base and multiplier in ISIS3. Use the ISIS fx command to apply offsets to floating-point data.

gdal2PLY.py

Converts digital elevation models (DEMs) to PLY mesh format for 3D visualization.

Usage

Parameters

string
required
Input DEM in any GDAL-supported format
string
required
Output PLY mesh file (binary format)

Features

  • Creates binary PLY format for efficient storage
  • Generates triangulated mesh from DEM grid
  • Preserves X, Y, Z coordinates
  • Suitable for import into 3D visualization software

NoData Handling

The script does not currently handle NoData values. Use this workaround:
  1. Find the minimum elevation:
  2. Set NoData to a value below minimum and resample:
  3. Run gdal2PLY on the processed file

Example

Output Format

PLY format includes:
  • Vertex positions (x, y, z)
  • Triangle face definitions
  • Binary encoding for efficiency

gdal2gores.py

Remaps Simple Cylindrical projected images into gore projections for printing and mounting on spheres.

Usage

Parameters

integer
required
Number of gores to generate (default: 8)
string
required
Input Simple Cylindrical map projection image
string
required
Output gore image (GeoTIFF format)
flag
Quiet mode - suppress progress output

How It Works

  1. Divides the input image into N vertical strips (gores)
  2. Applies cosine warping to each gore based on latitude
  3. Creates output suitable for cutting and mounting on spherical objects

Example

Use Cases

  • Creating physical globe models
  • Educational materials
  • Art and craft projects with planetary maps
  • Tennis ball or baseball sphere mapping
Input image must be in Simple Cylindrical projection. Use gdalwarp to reproject if necessary.

gdal2xyz_geocentricSpace.py

Converts elevation DEMs to geocentric (body-fixed) XYZ ASCII coordinates.

Usage

Parameters

string
required
Input elevation DEM (elevation values in meters)
string
Output ASCII file (defaults to stdout)

Options

integer
Sampling factor to skip pixels (default: 1)
float
Body radius in meters (default: 1737400.0 for Moon)
integer
Band number containing variable radius values
integer
Band number containing latitude values
integer
Band number containing longitude values
integer
Elevation band number (default: 1)
xoff yoff width height
Process only a subset window
flag
Add CSV header line to output
flag
Output Lon,Lat,Elevation instead of X,Y,Z

Output Format

Default output (body-fixed coordinates):
With -printLatLon:

Coordinate Calculation

For spherical bodies:

Example

Default Radii

  • Moon: 1,737,400 m
  • Mars: 3,396,190 m (use -radius option)
  • Other bodies: specify with -radius

AsterMeta2Shapefile.py

Converts a directory of ASTER metadata (.meta) files into a polygon shapefile.

Usage

Parameters

string
required
Output shapefile name

How It Works

  1. Searches current directory for all *.meta files
  2. Extracts corner coordinates from each metadata file
  3. Creates polygon features with ASTER scene ID as attribute
  4. Outputs WGS84 geographic coordinate system shapefile

Metadata File Format

Expects ASTER metadata files with format:

Example

Output:

Output Attributes

  • Name - ASTER scene identifier
  • Geometry - Polygon footprint

Use Cases

  • Creating ASTER scene coverage maps
  • Planning data acquisitions
  • Visualizing available data in GIS
  • Filtering scenes by location
Script will exit if output shapefile already exists. Remove existing file first.

ogr_footprintinit2shp (footprintinit2shp.py)

Converts ISIS3 caminfo geometry PVL files to ESRI Shapefiles with WKT geometry.

Usage

Parameters

string
required
Input PVL file from ISIS3 caminfo command
string
WKT projection file to define coordinate system

ISIS3 Workflow

To create a PVL file ready for this tool:
1

Initialize SPICE data

2

Generate footprint

3

Extract camera info

4

Convert to shapefile

Output Files

Creates multiple files:
  • .shp - Shapefile geometry
  • .shx - Shapefile index
  • .dbf - Attribute database
  • .prj - Projection file (if input projection provided)
  • .csv - Intermediate CSV with WKT
  • .vrt - Virtual format file

Use Cases

  • Footprint cataloging - Create spatial index of image coverage
  • Mission planning - Visualize existing image coverage
  • Data discovery - Find images covering specific regions
Column names from PVL will be truncated to fit shapefile field name limits (10 characters).

ogr_isisminer2shp (isisminer2shp.py)

Converts ISIS3 isisminer CSV results to ESRI Shapefiles.

Usage

Parameters

string
required
Input CSV file from isisminer command
string
WKT projection file for coordinate system definition

Requirements

Input CSV must contain geometry columns. Common isisminer geometry formats:
  • WKT (Well-Known Text) geometry column
  • Separate latitude/longitude columns
  • Footprint polygon coordinates

Use Cases

  • Analysis results visualization - Convert isisminer analysis to GIS format
  • Quality control - Spatially review data mining results
  • Integration - Combine with other GIS datasets

Requirements

Common Dependencies

All conversion scripts require:
  • Python 2.7+ or Python 3.x (script-dependent)
  • GDAL/OGR Python bindings

Additional Dependencies

  • gdal2PLY.py: NumPy
  • gdal2xyz_geocentricSpace.py: NumPy/Numeric
  • ogr_footprintinit2shp: pvl library
  • ogr_isisminer2shp: pvl library (if using WKT geometry)

Installation

Author

Developed by Trent Hare and contributors at USGS Astrogeology Science Center.